import {createRouter, createWebHistory} from 'vue-router';
export const routes = [
  {
    path:"/",
    redirect: '/index'
  },
  {
    path:'/index',
    isMenu:true,
    meta:{
      title:'首页',
      sort:0
    },
    component:()=>import('@/pages/Home.vue'),
    children: [
      {
        path:'',
        name:'index',
        component:()=>import('@/pages/Index.vue'),
        meta:{
          title:'首页'
        }
      }
    ]
  },
  {
    path:'/goods',
    isMenu:true,
    meta:{
      title:'商品管理',
      sideTitle:'商品管理',
      sort:1
    },
    component:()=>import('@/pages/Home.vue'),
    children:[
      {
        path:"/goods",
        redirect: '/goods/publishGoods'
      },
      {
        path:'publishGoods',
        name:'publishGoods',
        component:()=>import('@/pages/goods/PublishGoods.vue'),
        meta:{
          title:'发布商品',
        }
      },
      {
        path:'brandManagement',
        name:'brandManagement',
        component:()=>import('@/pages/goods/BrandManagement.vue'),
        meta:{
          title:'品牌管理',
        }
      }
    ]
  },
  
  {
    path:'/login',
    name:'login',
    component:()=>import('@/pages/Login.vue'),
    meta:{
      title:'登录'
    }
  },
  {
    path:'/404',
    name:'404',
    component:()=>import('@/pages/404.vue'),
    meta:{
      title:'404'
    }
  },
  {
    path: '/:catchAll(.*)',    // 匹配所有路径  vue2使用*   vue3使用/: pathMatch(.*)* 或 /: pathMatch(.*) 或 /: catchAll(.*)
    redirect: '/404',
  },
];
const router=createRouter({
  history:createWebHistory(),
  routes
})

export default router;